<template>
  <view class="container">
    
    <view class="title">
      <view class="font-36 text-bold">{{detail.title}}</view>
      <view class="font-24">
        <text class="c-a4">发布于 {{$util.timeStampTurnTime(detail.create_time)}}</text>
      </view>
    </view>
    <view class="content" v-if="detail.text">
        <rich-text :nodes="detail.text" :data-nodes="detail.text"></rich-text>
    </view>
    
  </view>
</template>

<script>
import htmlParser from '@/common/js/html-parser';
  export default {
    data() {
      return {
        id: '',
        detail: {}
      }
    },
    onLoad(e) {
      this.id = e.id;
      this.getDetail()
    },
    methods: {
      getDetail() {
        this.$api.sendRequest({
          url: "/sitemessage/api/sitemessage/getSiteMessageRecordsInfo",
          data: {
            id: this.id
          },
          success: res => {
            if(res.code == 0) {
              	this.detail = res.data;

                if (this.detail.text) this.detail.text = htmlParser(this.detail.text);

                uni.setNavigationBarTitle({
                  title: this.detail.title
                })
            }else {
              this.$util.showToast({title: res.message})
            }
          }
        })
      },
    }
  }
</script>

<style>
  page {
    background: #fff;
  }
</style>
<style lang="scss" scoped>
.title {
  margin: 30rpx;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 30rpx;
}
.content {
  margin: 30rpx;
}
</style>
